/*#include <stdio.h>
int main()
{
	char ch;
	int n;
	scanf("%c %d",&ch,&n);
		if ((ch >= 'a' && ch <= 'z') ||( ch >= 'A' && ch <= 'Z'))
		{
			n = n % 26;
			ch = ch + n;
			if (ch > 'z'&&ch<='z'+ 26 || (ch > 'Z' && ch<='Z'+26))
			{
				ch = ch - 26;
			}
			printf("%c",ch);
		}
		else if (ch >= '0' && ch <= '9')
		{
			printf("%c", ch);
		}
	return 0;
}

#include <stdio.h>

int main()
{
    int a, b;
    char op;
    scanf("%d%c%d", &a, &op, &b);

    switch (op)
    {
    case '+':
    {
        if ((int)(a + b) == a + b)
        {
            printf("%d", a + b);
        }
        else
        {
            printf("%.2lf", (double)(a + b));
        }
        break;
    }
    case '-':
    {
        if ((int)(a - b) == a - b)
        {
            printf("%d", a - b);
        }
        else
        {
            printf("%.2lf", (double)(a - b));
        }
        break;
    }
    case '*':
    {
        if ((int)(a * b) == a * b)
        {
            printf("%d", a * b);
        }
        else
        {
            printf("%.2lf", (double)(a * b));
        }
        break;
    }
    case '/':
    {
        if (b == 0)
        {
            printf("Divisor cannot be 0!");
        }
        else
        {
            if ((int)(a / b) == a / b)
            {
                printf("%d", a / b);
            }
            else
            {
                printf("%.2lf", (double)(a / b));
            }
        }
        break;
    }
    default:
    {
        printf("Unknown operator!");
    }
    break;
    }

    return 0;
}
#include <stdio.h>
int main()
{
	double a, b;
	char op;
	scanf("%lf%c%lf", &a, &op, &b);
	switch (op)
	{
	case '+':
	{
		if (a + b ==(int)(a+b)) {
			printf("%d", a + b);
		}
		else {
			printf("%.2lf",(double)( a + b));
		}
		break;
	}
case '-':
{
	if (a - b == (int)(a - b)) {
printf("%d", a - b);
	}
	else {
		printf("%.2lf", (double)(a - b));
	}
	break;
}
case '*':
{
	if (a * b == (int)(a * b)) {
		printf("%d", a * b);
	}
	else {
		printf("%.2lf", (double)(a * b));
	}
	break;
}
case '/':
{
	if (b == 0)
	{
		printf("Divisor cannot be 0!");
	}
	else
	{
		if (a / b == (int)(a*1.0 / b)) {
			printf("%d", a / b);
		}
		else {
			printf("%.2lf", (double)(a*1.0 / b));
		}
	}
	break;
}
default:
{
		printf("Unknown operator!");
	}
break;
}
return 0;
}*/ 
#include <stdio.h>
int main()
{
	int n,m;
	scanf("%d %d",&n,&m);
	int arr1[1000]={0};
	int arr2[1000]={0};
	int i=0;
	int j=0;
	for(i=0;i<0;i++)
	{
		scanf("%d",arr1[i]);
	}
	for(i=0;i<0;i++)
	{
		scanf("%d",arr2[i]);
	}
	while(i<n&&j<m)
	{
		if(arr1[i]<=arr2[j]);
	{
		printf("%d",arr1[i]);
	}
	else if
	{
		printf("%d",arr2[j]);
	}
	}
	while(i<n)
	{
		printf("%d",arr1[i]);
	}
	while(j<m)
	{
		printf("%d",arr2[j]);
	}
	return 0;
 } 
